package org.zjt.book
// Akka并发计算实例

import akka.actor.{Actor, ActorPath, ActorRef, ActorSystem, Props}

/** 1、actor执行的任务 */
class HelloActor extends Actor{

  override def receive = {
    case "hello" => println("world")
    case _ => println("huh?")
  }

}




/** 2、单例配置类，用来装配actor */
object HelloActor{
  def props = Props[HelloActor]
}

object Boot extends App{
  /** 3、配置actor */
  val system = ActorSystem("HelloSystem")
  val helloActor = system.actorOf(HelloActor.props, name = "helloactor")

  helloActor ! "hello"
  helloActor ! "hah"



  //关闭ActorSystem
  system.terminate()

}